<?php
	//
	//This php will handle the 
	// UserFetch.java 
	// - fetchUserById function
	//
	
	//Connect to database
	include '../../dbc.php';
	
	$user = $_POST['user'];
	$user_follow = $_POST['user_follow'];
	$follow_time = date("Y-m-d H:i:s");
	
	//Check is activated
    $query01 = "SELECT * FROM user_follow WHERE user='$user' AND user_follow='$user_follow'";
	$query01_result = mysql_query($query01);
	if($query01_result){
		if(mysql_num_rows($query01_result) > 0){
			//Already follow
			$response["STATUS"] = "1";	
		}else{
			$query02 = "INSERT INTO user_follow (user,user_follow,follow_time) VALUES ('$user','$user_follow','$follow_time')";	
			if(mysql_query($query02)){
				$response["STATUS"] = "1";
			}else{
				$response["STATUS"] = "0";
			}
		}
		echo json_encode($response);
	}else{
		$response["STATUS"] = "0";
		echo json_encode($response);
	}
?>